/**
 * @param {number[]} nums
 * @return {number}
 */
var singleNumber = function (nums) {
  let arr = []
  nums.forEach(item => {
    const index = arr.indexOf(item)
    if (index < 0) {
      arr.push(item)
    } else {
      arr.splice(index, 1)
    }
  })
  return arr[0]
}
